# Contributor (MSYS2): David Macek <david.macek.0@gmail.com>
# Maintainer (AUR): Kerrick Staley <mail@kerrickstaley.com>
# Contributor (AUR): Thijs Vermeir <thijsvermeir@gmail.com>

_realname=jhbuild
pkgname="${_realname}-git"
pkgver=8203.d465faa
pkgrel=1
pkgdesc='Downloads and compiles Gnome "modules", i.e. source code packages.'
url='https://live.gnome.org/Jhbuild/'
arch=('i686' 'x86_64')
license=('GPL')
depends=('python2')
makedepends=('rsync'
             'subversion'
             'gnome-common'
             'git'
             'intltool'
             'gnome-doc-utils'
             'yelp-tools')
provides=("${_realname}")
conflicts=("${_realname}")
source=('git://git.gnome.org/jhbuild'
        'module_autogenargs.patch')
sha256sums=('SKIP'
            'f92dd2735e47d0032f4069fbf1c4d1207c83eabd0a6317ea78f39d6157e854b2')

pkgver() {
  cd "${srcdir}/${_realname}"
  printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
    cd "${_realname}"
    patch -p1 -i "${srcdir}/module_autogenargs.patch"
    sed 's/env python2$/python2/' -i scripts/jhbuild.in
    ./autogen.sh --prefix=/usr PYTHON=/usr/bin/python2
    make
}

package() {
    cd "${_realname}"
    make DESTDIR="${pkgdir}" install
    install -d "${pkgdir}/usr/share/jhbuild"
    cp -dr modulesets "${pkgdir}/usr/share/jhbuild"
}